package main

import (
	"flag"
	"go-monitor/agent/g"
	opsrpc "go-monitor/agent/rpc"
	"go-monitor/agent/service"
	"go-monitor/agent/sys"
)

func main() {
	g.Logger.Info("Start Agent Version:", g.VERSION)

	cfg := flag.String("c", g.Root+"/cfg.json", "configuration file")
	flag.Parse()
	g.ParseConfig(*cfg)

	g.InitLocalIps()
	g.InitRPCClients()

	sys.UpdateNotice()
	sys.ReportAgentStatus()

	service.InitAuth()
	service.AuthLogin()

	go opsrpc.StartRPC()
	sys.AutoUpdate()
	select {}
}
